home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Sample Code Update 01⁄96 / Fragment Tool / Sources / FragmentStuff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-20  |  2.3 KB  |  123 lines  |  [TEXT/MPCC]

  1. /*
  2.     File:        FragmentStuff.h
  3.  
  4.     Contains:    Data structures which define the 'cfrg' resource format
  5.                 and a our own independent data structure containing the
  6.                 information we need, in a simple format.
  7.     
  8.     Written by:    Chris White, Developer Technical Support
  9.     
  10.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  11.     
  12.     Change History (most recent first):
  13.     
  14.                   9/28/95    CW        First release
  15.  
  16. */
  17.  
  18.  
  19. #ifndef __FRAGMENTSTUFF__
  20. #define __FRAGMENTSTUFF__
  21.  
  22.  
  23.  
  24. #ifndef __TYPES__
  25.     #include <Types.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. // The format of the 'cfrg' on disk. This is defined in <CodeFragmentTypes.r>
  32. #ifdef powerc
  33.     #pragma options align=mac68k
  34. #endif
  35.  
  36.  
  37. struct cfrgHeader
  38. {
  39.     long     res1;
  40.     long     res2;
  41.     long     version;
  42.     long     res3;
  43.     long     res4;
  44.     long     filler1;
  45.     long     filler2;
  46.     long     itemCount;
  47.     char    arrayStart;    // Array of externalItems begins here
  48. };
  49. typedef struct cfrgHeader cfrgHeader, *hdrPtr, **hdrHand;
  50.  
  51. struct cfrgItem
  52. {
  53.     OSType     archType;
  54.     long     updateLevel;
  55.     long    currVersion;
  56.     long    oldDefVersion;
  57.     long    appStackSize;
  58.     short    appSubFolder;
  59.     char    usage;
  60.     char    location;
  61.     long    codeOffset;
  62.     long    codeLength;
  63.     long    res1;
  64.     long    res2;
  65.     short    itemSize; // %4 == 0
  66.     Str255    name;
  67.     // Only make the final p-string as long as needed, then align to
  68.     // a longword boundary
  69. };
  70. typedef struct cfrgItem cfrgItem;
  71. #ifdef powerc
  72.     #pragma options align=reset
  73. #endif
  74.  
  75.  
  76. struct TempFileRec
  77. {
  78.     int        usageCount;
  79.     FSSpec    fileSpec;
  80. };
  81.  
  82. typedef struct TempFileRec tTempFileRec, *tTempFilePtr;
  83.  
  84.  
  85. /* Record for each fragment. Includes simplified version of the 'cfrg' data */
  86. struct internalItem
  87. {
  88.     /* Data used for the application */
  89.     Boolean            bDeleted;
  90.     Boolean            bExistsInDocument;
  91.     tTempFilePtr    tempFilePtr;
  92.     
  93.     /* Data included in the 'cfrg' resource */
  94.     OSType     archType;
  95.     long     updateLevel;
  96.     long    currVersion;
  97.     long    oldDefVersion;
  98.     long    appStackSize;
  99.     short    appSubFolder;
  100.     short    usage;
  101.     short    location;
  102.     long    codeOffset;
  103.     long    codeLength;
  104.     Str255    name;
  105. };
  106. typedef struct internalItem tItem, *tItemPtr;
  107.  
  108. struct internalResource {
  109.     long             version;
  110.     long             itemCount;
  111.     tItem            itemList[1];
  112. };
  113. typedef struct internalResource tHeader, *tHeaderPtr, **tHeaderHan;
  114.  
  115. /* ===== Prototypes ===== */
  116. OSErr ParseResource (Handle theResource, tHeaderHan internalCopy);
  117. OSErr BuildResource (tHeaderHan internalCopy, Handle theResource);
  118.  
  119.  
  120.  
  121.  
  122. #endif // define __FRAGMENTS__
  123.